//
//  RecommedTableViewCell.m
//  JZMCFM
//
//  Created by Mc on 15/10/31.
//  Copyright (c) 2015年 陈卓. All rights reserved.
//

#import "RecommedTableViewCell.h"

@implementation RecommedTableViewCell



-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setcell];
    }
    return self;
}

- (void)setcell
{
    
    self.triangimage = [[UIImageView alloc]initWithFrame:CGRectMake(10, 5, kscreenwidth/20, 0)];
    self.triangimage.image = [UIImage imageNamed:@"iconfont-sanjiaoyou"];
    [self addSubview:self.triangimage];
    self.titleLable = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.triangimage.frame), self.triangimage.frame.origin.y, kscreenwidth/3*2, self.triangimage.frame.size.height)];
    [self.contentView addSubview:self.titleLable];
    
//    self.moreButton = [UIButton buttonWithType:UIButtonTypeSystem];
//    self.moreButton.frame = CGRectMake(CGRectGetMaxX(self.titleLable.frame), self.triangimage.frame.origin.y, kscreenwidth/3, self.triangimage.frame.size.height);
//    [self.moreButton setTitle:@"更多" forState:UIControlStateNormal];
//    [self.moreButton setTintColor:[UIColor orangeColor]];
//    [self addSubview:self.moreButton];
    
    
    
//    self.picbuttonOne = [UIButton buttonWithType:UIButtonTypeSystem];
//    self.picbuttonOne.frame = CGRectMake(self.triangimage.frame.origin.x, CGRectGetMaxY(self.triangimage.frame), (kscreenwidth-40)/3, (kscreenwidth-40)/3);
//    [self.contentView addSubview:self.picbuttonOne];
//    
//    self.picbuttonTwo = [UIButton buttonWithType:UIButtonTypeSystem];
//    self.picbuttonTwo.frame = CGRectMake(CGRectGetMaxX(self.picbuttonOne.frame)+10, self.picbuttonOne.frame.origin.y, (kscreenwidth-40)/3,(kscreenwidth-40)/3);
//    [self.contentView addSubview:self.picbuttonTwo];
//    
//    self.picbuttonThree = [UIButton buttonWithType:UIButtonTypeSystem];
//    self.picbuttonThree.frame = CGRectMake(CGRectGetMaxX(self.picbuttonTwo.frame)+10, self.picbuttonOne.frame.origin.y, (kscreenwidth-40)/3,(kscreenwidth-40)/3);
//    [self.contentView addSubview:self.picbuttonThree];
    
    
    
    
    self.picImageOne =[[UIImageView alloc]initWithFrame:CGRectMake(self.triangimage.frame.origin.x,CGRectGetMaxY(self.triangimage.frame), (kscreenwidth-40)/3, (kscreenwidth-40)/3)];
    [self.contentView addSubview:self.picImageOne];
    
    
    self.longlableOne = [[UILabel alloc]initWithFrame:CGRectMake(self.triangimage.frame.origin.x, CGRectGetMaxY(self.picImageOne.frame), (kscreenwidth-40)/3, 30)];
    [self.contentView addSubview:self.longlableOne];
    
    
    
    self.picImageTwo = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.picImageOne.frame)+10, CGRectGetMaxY(self.triangimage.frame), (kscreenwidth-40)/3, (kscreenwidth-40)/3)];
    [self.contentView addSubview:self.picImageTwo];
    
    self.longlableTwo = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.longlableOne.frame)+10, self.longlableOne.frame.origin.y, (kscreenwidth-40)/3, 30)];
    [self.contentView addSubview:self.longlableTwo];
    
    self.picImageThree = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.picImageTwo.frame)+10,self.picImageOne.frame.origin.y, (kscreenwidth-40)/3, (kscreenwidth-40)/3)];
    [self.contentView addSubview:self.picImageThree];
    
    self.longlableThree = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.longlableTwo.frame)+10, self.longlableTwo.frame.origin.y, (kscreenwidth-40)/3, 30)];
    [self.contentView addSubview:self.longlableThree];
    
    
    
    
}



- (void)setdataCellWithModel:(RecommedModel *)model
{
        for (int i = 0; i < [RecommedHelper shareInstance].editorRecommendAlbumsArray.count; i ++ ) {
            RecommedModel *model  = [RecommedHelper shareInstance].editorRecommendAlbumsArray[i];
            NSLog(@"999999999%ld",[RecommedHelper shareInstance].editorRecommendAlbumsArray.count);
            switch (i) {
                case 0:
                     [self.picImageOne sd_setImageWithURL:[NSURL URLWithString:model.coverLarge]];
                    self.longlableOne.text = model.trackTitle;
                    self.longlableOne.numberOfLines = 0;
                    self.longlableOne.font = [UIFont systemFontOfSize:11];
                    break;
                case 1:
                    [self.picImageTwo sd_setImageWithURL:[NSURL URLWithString:model.coverLarge]];
                    self.longlableTwo.text = model.trackTitle;
                    self.longlableTwo.numberOfLines = 0;
                    self.longlableTwo.font = [UIFont systemFontOfSize:11];
                    break;
                case 2:
                    [self.picImageThree sd_setImageWithURL:[NSURL URLWithString:model.coverLarge]];
                    self.longlableThree.text = model.trackTitle;
                    self.longlableThree.numberOfLines = 0;
                    self.longlableThree.font = [UIFont systemFontOfSize:11];
    
                    break;
                default:
                    break;
            }
    
        }
    
}
- (void)setdataCellWithModel11:(NSArray *)arr
{
    NSLog(@"%ld",arr.count);
    for (int i = 0; i < arr.count; i ++ ) {
        RecommedModel *model  = arr[i];
        NSLog(@"===================%ld",[RecommedHelper shareInstance].hotRecommendsArray.count );
        switch (i) {
            case 0:
                [self.picImageOne sd_setImageWithURL:[NSURL URLWithString:model.coverLarge]];
                self.longlableOne.text = model.trackTitle;
                self.longlableOne.numberOfLines = 0;
                self.longlableOne.font = [UIFont systemFontOfSize:11];
                break;
            case 1:
                [self.picImageTwo sd_setImageWithURL:[NSURL URLWithString:model.coverLarge]];
                self.longlableTwo.text = model.trackTitle;
                self.longlableTwo.numberOfLines = 0;
                self.longlableTwo.font = [UIFont systemFontOfSize:11];
                break;
            case 2:
                [self.picImageThree sd_setImageWithURL:[NSURL URLWithString:model.coverLarge]];
                self.longlableThree.text = model.trackTitle;
                self.longlableThree.numberOfLines = 0;
                self.longlableThree.font = [UIFont systemFontOfSize:11];
                
                break;
            default:
                break;
        }
        
    }

    
    
}


@end
